home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
007
/
c80tcog.lbr
/
XDPB.CQ
/
xdpb.c
Wrap
Text File
|
1985-08-09
|
3KB
|
85 lines
/* xdpb.c - dump the CP/M disk param block in hex and ASCII */
/* Version 1.2 1982/12/18 19:56 */
/*
Inspired by the assembly language routine ACTDIR in
David E. Cortesi's INSIDE CP/M: A Guide for Users and Programmers,
Holt, Rinehart and Winston, New York 1982, p. 216-218.
C version:
Copyright 1982 William G. Hutchison, Jr.
P.O. Box 278
Exton, PA 19341-0278
U.S.A.
CompuServe 70665,1307
This program may be used freely for any non-commercial
purpose, provided that the user does not remove or alter
this notice or the copyright statement.
Those who wish to sell or lease this program, or to
incorporate it into a product for sale or lease, should
apply to the author (above) for licensing information.
This program is not covered by a warranty, either
express or implied. The author shall not be responsible for
any damages (including consequential) caused by reliance on
the materials presented, including but not limited to
typographical errors or arithmetic errors.
This version is for C/80 Version 2 from Software Toolworks.
*/
#include "c80def.h"
#define uns unsigned
#include "printf.c"
#include "dpb.h"
#include "fcb.h"
static struct fcb *cpmfcb= 0x5C;
#include "bdos.c"
#define DEFAULT_DRIVE 25
#define DISK_PARAMETERS 31
#define SELECT_DRIVE 14
#include "davcor.c"
main()
{
int drive;
struct dpb *x;
static char Version[]= "Version 1.2 1982/12/18 19:56";
static char Notice[]= "Copyright 1982 William G. Hutchison, Jr.";
printf("%s\n%s\n\n", Version, Notice);
if ((drive= cpmfcb->drv) == 0)
drive= bdos(DEFAULT_DRIVE, 0);
else
drive-- /* 1..26 => 0..25 */;
bdos(SELECT_DRIVE, drive);
x= bdos(DISK_PARAMETERS, 0);
printf("Disk Parameter block for drive %c.\n", 'A'+drive);
printf("SPT: %4x records per track\n", x->spt);
printf("BSH: %2x recno >> BSH == block number\n", x->bsh & 0xFF);
printf("BLM: %2x recno & BLM == record in block\n", x->blm & 0xFF);
printf("EXM: %2x logical extent vs. physical\n", x->exm & 0xFF);
printf("DSM: %4x highest block # (origin 0)\n", x->dsm);
printf("DRM: %4x highest directory number (origin 0)\n",x->drm);
printf("ALV: %4x bits reserving directory blocks\n", x->alv);
printf("CKS: %4x size of check vector in bytes\n", x->cks);
printf("OFF: %4x number of reserved tracks.\n", x->off);
printf("\n");
printf("%4x:\n", x);
hex_dump(x, DPB_SIZE);
}